<div class="container">
	<% if @member.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@member.errors.count, "error") %> prohibited this groups_thread from being saved:</h2>

      <ul>
      <% @member.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>


  <div class="span-12">
  	
    <h1>Profil</h1>
  <%= form_for(@member) do |f| %>
  
  <% if not current_member.is_approved? or current_member.is_admin? %>
  <div class="form">
  <%= f.label :name, "Ime" %> <br>
  <%= f.text_field :name%>
  </div>
  
  <div class="form">
  <%= f.label :surname, "Prezime" %> <br>
  <%= f.text_field :surname%>
  </div>
  
  
  <div class="form">
  <%= f.label :birthday, "Datum rođenja" %> <br>
  <%= f.date_select :birthday, {:start_year => 1940, :end_year => Time.now.year - 13} %>
  </div>
  <% end %>
  
  <% if current_member.is_admin? %>
  <div class="form">
    <%= f.label :membership_id, "Tip članstva" %> <br>
    <%= collection_select(:member, :membership_id, @memberships, :id, :name) %>  
  </div>
  
  <div class="form">
    <%= f.label :permission_id, "Razina dopuštenja" %> <br>
    <%= collection_select(:member, :permission_id, @permissions, :id, :name) %>
  </div>
  <% end %>
  
  <% #always avaliable %>
  
  <div class="form">
  <%= f.label :city, "Grad" %> <br>
  <%= f.text_field :city %>
  </div>
  
  <div class="form">
  <%= f.label :address, "Adresa" %> <br>
  <%= f.text_field :address%>
  </div>
  
  
  
  <div class="form">
  <%= f.label :nickname, "Nadimak" %> <br>
  <%= f.text_field :nickname %>
  </div>
  
  
  <div class="form">
  <%= f.label :occupation, "Trenutno se bavim sa... (škola/faks/posao)" %> <br>
  <%= f.text_field :occupation %>
  </div>
  
  <div class="form">
  <%= f.label :about, "Malo više o meni" %> <br>
  <%= f.text_area :about%>
  </div>
  <%= f.submit "Spremi podatke" %>
  
  <% end %>
  </div>
  
  <div class="span-12 last">
    <h1>Avatar</h1>
    <% if @member.photo? %>
    <%= image_tag @member.photo.url, { :class => 'avatar'} %>
    <% else %>
    <%= image_tag('avatars/default.png')%>
    <% end %>
    <div class="form">
    <%= form_for(@member, :html => { :multipart => true }) do |f| %>
      <%= f.file_field :photo%> <br />
      <%= f.submit "Upload" %>
    <% end %>
  </div>
  </div>
</div>